#include <stdio.h>  
  
void merge(int arr1[], int arr2[], int n1, int n2) {  
    int i = 0, j = 0, k = 0;  
    while (i < n1 && j < n2) {  
        if (arr1[i] <= arr2[j]) {  
            arr1[k++] = arr1[i++];  
        } else {  
            arr1[k++] = arr2[j++];  
        }  
    }  
    while (i < n1) {  
        arr1[k++] = arr1[i++];  
    }  
    while (j < n2) {  
        arr1[k++] = arr2[j++];  
    }  
}  
  
int main() {  
    int arr1[] = {1, 3, 5, 7};  
    int arr2[] = {2, 4, 6, 8};  
    int n1 = sizeof(arr1) / sizeof(arr1[0]);  
    int n2 = sizeof(arr2) / sizeof(arr2[0]);  
    int merged_arr[n1 + n2];  
    merge(merged_arr, arr2, n1, n2);  
    for (int i = 0; i < n1 + n2; i++) {  
        printf("%d ", merged_arr[i]);  
    }  
    return 0;  
}


